home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / STRINGS.SWG / 0033_Get File Extension String.pas < prev    next >
Pascal/Delphi Source File  |  1993-09-26  |  803b  |  22 lines

  1. {*****************************************************************************
  2.  * Function ...... GetExt()
  3.  * Purpose ....... To return the extention (minus the dot) of a filepath
  4.  * Parameters .... Path      Filepath/mask to return the extension of
  5.  * Returns ....... Three character DOS file extension
  6.  * Notes ......... Uses functions Right, Empty, and PadR
  7.  * Author ........ Martin Richardson
  8.  * Date .......... October 23, 1992
  9.  *****************************************************************************}
  10. FUNCTION GetExt( Path: DirStr ): ExtStr;
  11. VAR dir  : DirStr;
  12.     name : NameStr;
  13.     ext  : ExtStr;
  14. BEGIN
  15.      FSPLIT( path, dir, name, ext );
  16.      IF NOT Empty( Name ) THEN
  17.          GetExt := Right( PadR( ext, 4, ' ' ), 3 )
  18.      ELSE
  19.          GetExt := '    ';
  20. END;
  21.  
  22.